package com.juyu.miliao.api.dao.mysql;

import com.juyu.miliao.common.domain.OpenApiStatus;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author jh
 * 2018/11/13
 */
@Repository
public class OpenApiStatusDao {

    @Resource
    private SqlSession sqlSession;

    /**
     * 这个方法用不到索引
     */
    public OpenApiStatus getOpenApiStatusByJoin(String versionNum, Integer phoneSystem, String appPackageId, String channel) {
        Map<String, Object> map = new HashMap<>(8);
        map.put("phoneSystem", phoneSystem);
        map.put("appPackageId", appPackageId);
        map.put("versionNum", versionNum);
        map.put("channel", channel);
        return sqlSession.selectOne("getOpenApiStatusByJoin", map);
    }

    public OpenApiStatus getOpenApiStatus(String versionNum, Integer phoneSystem, String appPackageId, String channel) {
        Map<String, Object> map = new HashMap<>(8);
        map.put("phoneSystem", phoneSystem);
        map.put("appPackageId", appPackageId);
        map.put("versionNum", versionNum);
        map.put("channel", channel);
        return sqlSession.selectOne("getOpenApiStatus", map);
    }



    public OpenApiStatus getOpenApiStatusByWhere(String versionNum, Long configAppId, String channel) {
        Map<String, Object> map = new HashMap<>(4);
        map.put("versionNum", versionNum);
        map.put("configAppId", configAppId);
        map.put("channel", channel);
        return sqlSession.selectOne("getOpenApiStatusByWhere", map);
    }


}
